Panels and buttons 
      

The bitmap can be changed on the fly by doing this: 
1. Make your button graphics for pressed, unpressed and mouse-over conditions. Don't put any text or image to identify the button. Its an empty button. 

2. Declare your button where you want it in the panel definition. 

3. Declare a window with the exact same x and y position as the button definition except offset by the border that gives the button the pressed, unpressed, and mouse-over look. 

4. Make the window height and width the same as the inside blank part of the button without the edge that makes it look pressed, unpressed and mouse-over. 

5. Now create a bitmap with all of the different button images and/or texts that will go in the center of your empty button. Make them the exact height and width as what you declared in your window definition. Place each button image to the right of the one before it. 

6. Declare the bitmap from step 5 like this:
BMAP button_guts, <buttons.pcx>; 

7. declare a variable called button_guts_x and set it to 0:
var button_guts_x = 0; 

8. now, finish declaring your window definition in the panel definition by using the bitmap you declared as the bitmap and button_guts_x as your var_x and 0 as your var_y. 

9. if you want to change the button image now, simply change button_guts_x using this formula:
button_guts_x = gut_width * gut_index;
where gut_width is the width of each button gut image in your bitmap and gut_index is the number of the button image to show from left to right starting at 0. 

button_guts_x can also be used in your button function to determin which image is currently being shown and therefore which action to take. Simply divide button_guts_x by gut_width and you get the gut_index. 

Hope this is clear. Good luck!
